//==值比较 ===类型比较
function $(id){
    return typeof id === 'string'? document.getElementById(id):id
}

window.onload = function() {
    var titles = $('tab-header').getElementsByTagName('li')
    var divs = $('tab-content').getElementsByTagName('div')
    //判断
    if (titles.length != divs.length) return;//标题的个数要等于内容的个数

    for (var i = 0; i < titles.length; i++) {
        var li = titles[i];
        li.id = i;

        li.onmousemove = function () {
            //this代表当前li
            //遍历所有的标签全部都先隐藏
            for (var j = 0; j < titles.length; j++) {
                titles[j].className = '';
                divs[j].style.display = 'none'

            }

            //让当前的被选中 显示当前鼠标选中的
            this.className = 'select'
            divs[this.id].style.display = 'block'
        }

    }





}